<?php
require_once("../inc/conn.php");
require_once("../inc/session.php");
//接收传递来的值
$name=$_SESSION["admin"];
$type=$_POST["type"];
$num=$_POST["num"];
$pic=$_POST["file"];

//取得所属部门的id
$dsql="select * from userinfo where name='".$name."'";
$drs=$conn->query($sql);
$drow=$drs->fetch_assoc();
$sortid=$drow["sortid"];


	
	//定义SQL语句  实现写入
$sql="insert into shareinfo(name,sortid,pic,num,dt,type) values('".$name."','".$sortid."','".$pic."','".$num."',now(),'".$type."')";
//执行sql语句
$rs=$conn->query($sql);
if($rs){
	echo "<script>alert('写入成功！');location.href='sharelist.php';</script>";
	
}else{
	echo "<script>alert('写入失败！');location.href='addshare.php';</script>";
	
}





?>